package top.xierongsheng.user.dto;


import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Range;
import top.xierongsheng.user.dto.groups.Create;
import top.xierongsheng.user.dto.groups.Update;
import top.xierongsheng.user.dto.groups.UpdateStatus;


import jakarta.validation.constraints.*;

import java.io.Serial;
import java.io.Serializable;

/**
 * 菜单Dto
 *
 * @auther 谢荣生
 * @datetime 2020/10/28 14:30
 */

@Data
@Schema(description = "资源数据Dto")
@Accessors(chain = true)
public class ResourceDto implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "资源ID")
    @NotBlank(message = "资源Id名称不能为空", groups = {Update.class, UpdateStatus.class})
    private String id;

    @Schema(description = "资源父ID")
    private String parentId;

    @Schema(description = "资源名称")
    @NotBlank(message = "菜单或功能名称不能为空", groups = {Update.class, Create.class})
    private String name;

    @Schema(description = "资源地址")
    private String url;

    @Schema(description = "资源类型")
    @NotNull(message = "请选择资源类型", groups = {Update.class, Create.class})
    private Integer type;

    @Schema(description = "资源层级")
    private Integer level;

    @Schema(description = "资源排序号")
    @NotNull(message = "请输入菜单或功能排序", groups = {Update.class, Create.class})
    private Integer priority;

    @Schema(description = "资源图标")
    private String icon;

    @Schema(description = "资源权限代码")
    @NotBlank(message = "权限代码不允许为空", groups = {Update.class, Create.class})
    private String permission;

    @Schema(description = "资源状态")
    @NotNull(message = "status不能为空", groups = UpdateStatus.class)
    @Range(max = 1, min = 0, message = "status值应为0-1", groups = {UpdateStatus.class})
    private Integer status;
}
